<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="en">
<head>
    <script type="text/javascript" src="/js/jquery-2.0.3.min.js"></script>
    <meta charset="utf-8" />
    <title>管理系统</title>
    <meta name="keywords" content="管理系统" />
    <meta name="description" content="管理系统" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link href="/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="/assets/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/assets/css/font-awesome-ie7.min.css" />
    <link rel="stylesheet" href="\assets\css\cyrillic.css" />
    <link rel="stylesheet" href="\assets/css/ace.min.css" />
    <link rel="stylesheet" href="\assets/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="/assets/css/ace-ie.min.css" />
    <script src="/assets/js/html5shiv.js"></script>
    <script src="/assets/js/respond.min.js"></script>
    <![endif]-->

    <script type="text/javascript">
        function userLogin() {
            var username = $("#username").val();
            var password = $("#password").val();
            if (username==""||password==""){
                alert("用户名或密码不能为空");
            }else {
                $.post("/user/login.do", {username: username, password: password},
                    function (data) {
                        if (data == 1) {
                            window.location.href = "/control/index.do";
                        }
                        if (data == 0) {
                            alert("您输入的用户名或密码错误！");
                        }
                    });
            }
        }
        $(function(){
            $("#username").blur(function(){
                var len = $("#username").val().length;
                if(len==0){
                    $("#nameError").html("用户名不能为空！");
                }else{
                    $("#nameError").html("");
                }
            })
        })
        $(function(){
            $("#password").blur(function(){
                var len = $("#password").val().length;
                if(len==0){
                    $("#pwdError").html("密码不能为空！");
                }else {
                    $("#pwdError").html("");
                }
            })
        })
    </script>
</head>


<body class="login-layout"/>

<div class="main-container">
    <div class="main-content">
        <div class="row">
            <div class="col-sm-10 col-sm-offset-1">
                <div class="login-container">
                    <div class="center">
                        <h1>
                            <i class="icon-leaf green"></i>
                            <span class="red"></span>
                            <span class="white">管理系统</span>
                        </h1>
                        <h4 class="blue">&copy; 管理系统</h4>
                    </div>

                    <div class="space-6"></div>

                    <div class="position-relative">
                        <div id="login-box" class="login-box visible widget-box no-border">
                            <div class="widget-body">
                                <div class="toolbar clearfix">

                                </div>
                                <div class="widget-main">
                                    <h4 class="header blue lighter bigger">
                                        <i class="icon-coffee green"></i>
                                        请输入用户名和密码
                                    </h4>

                                    <div class="space-6"></div>

                                    <form>
                                        <fieldset>
                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="text" class="form-control" placeholder="用户名" id="username" name="username" />
                                                            <span style="color: red;" id="nameError"></span>
															<i class="icon-user"></i>
														</span>
                                            </label>

                                            <label class="block clearfix">
														<span class="block input-icon input-icon-right">
															<input type="password" class="form-control" placeholder="密码"  id="password" name="password" />
                                                            <span style="color: red;" id="pwdError"></span>
															<i class="icon-lock"></i>
														</span>
                                            </label>

                                            <div class="space"></div>

                                            <div class="clearfix">
                                                <label class="inline">
                                                    <input type="checkbox" style="display:none"/>
                                                    <span class="lbl"> </span>
                                                </label>

                                                <button type="button" id="register" onclick="window.location.href='/user/toRegister.do'" class="width-35 pull-right btn btn-sm btn-primary">
                                                    <i class="icon-key"></i>
                                                    注册
                                                </button>
                                                <button type="button" onclick="userLogin()" id="login"  class="width-35 pull-right btn btn-sm btn-primary">
                                                    <i class="icon-key"></i>
                                                    登陆
                                                </button>
                                            </div>

                                            <div class="space-4"></div>
                                        </fieldset>
                                    </form>

                                </div><!-- /widget-main -->
                            </div><!-- /widget-body -->
                        </div><!-- /login-box -->
                            </div><!-- /widget-body -->
                        </div><!-- /signup-box -->
                    </div><!-- /position-relative -->
                </div>
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div>
</div><!-- /.main-container -->



<!-- inline scripts related to this page -->
</body>
</html>